<template>
  <div class="mod-schedule">
    <el-form
      :inline="true"
      :model="dataForm"
    >
      <el-form-item>
        <el-input
          v-model="dataForm"
          placeholder="bean名称"
          clearable
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button @click="getDataList()">查询</el-button>
        <el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
        <el-button
          type="danger"
          @click="deleteHandle()"
          :disabled="dataListSelections.length <= 0"
          >批量删除</el-button
        >
        <el-button
          type="danger"
          @click="pauseHandle()"
          :disabled="dataListSelections.length <= 0"
          >批量暂停</el-button
        >
        <el-button
          type="danger"
          @click="resumeHandle()"
          :disabled="dataListSelections.length <= 0"
          >批量恢复</el-button
        >
        <el-button
          type="danger"
          @click="runHandle()"
          :disabled="dataListSelections.length <= 0"
          >批量立即执行</el-button
        >
        <el-button type="success" @click="logHandle()">日志列表</el-button>
      </el-form-item>
    </el-form>
    <el-table
      :data="list"
      border
      v-loading="dataListLoading"
      @selection-change="selectionChangeHandle"
      style="width: 100%"
    >
      <el-table-column
        type="selection"
        header-align="center"
        align="center"
        width="50"
      >
      </el-table-column>
      <el-table-column
        prop="jobId"
        header-align="center"
        align="center"
        width="80"
        label="ID"
      >
      </el-table-column>
      <el-table-column
        prop="beanName"
        header-align="center"
        align="center"
        label="bean名称"
      >
      </el-table-column>
      <el-table-column
        prop="methodName"
        header-align="center"
        align="center"
        label="方法名称"
      >
      </el-table-column>
      <el-table-column
        prop="params"
        header-align="center"
        align="center"
        label="参数"
      >
      </el-table-column>
      <el-table-column
        prop="cronExpression"
        header-align="center"
        align="center"
        label="cron表达式"
      >
      </el-table-column>
      <el-table-column
        prop="remark"
        header-align="center"
        align="center"
        label="备注"
      >
      </el-table-column>
      <el-table-column
        prop="status"
        header-align="center"
        align="center"
        label="状态"
      >
        
          <el-tag v-if="list.status === 0" size="small">正常</el-tag>
          <el-tag v-else size="small" type="danger">暂停</el-tag>
        
      </el-table-column>
      <el-table-column
        fixed="right"
        header-align="center"
        align="center"
        width="150"
        label="操作"
      >
        
          <el-button
            
            type="text"
            size="small"
            @click="addOrUpdateHandle(scope.jobId)"
            >修改</el-button
          >
          <el-button
            
            type="text"
            size="small"
            @click="deleteHandle(scope.jobId)"
            >删除</el-button
          >
          <el-button
            
            type="text"
            size="small"
            @click="pauseHandle(scope.jobId)"
            >暂停</el-button
          >
          <el-button
           
            type="text"
            size="small"
            @click="resumeHandle(scope.jobId)"
            >恢复</el-button
          >
          <el-button
            
            type="text"
            size="small"
            @click="runHandle(scope.jobId)"
            >立即执行</el-button
          >
        
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup>
import {ds} from "@/api/index"
import {onMounted,ref} from "vue"
const list=ref([])
onMounted(async () => {
  const res = await ds();
  console.log(res.data, "111");
  list.value = res.data.records;
  console.log(res.data.records);
});
const dataListSelections =ref([])
</script>
<style>

</style>